<?php get_header(); ?>

<div id="bigcolumn">

<?php 
	/**
	* decisione di inserire il box di ricerca solo nella sidebar
	* no box grande ricerca in home
	* Agata 06.06.2009
	*/
?>

<!--<div id="ricerca_home" class="featured">
	<div class="content">
        <?php #Box Ricerca Avvocati, Enrico, 25.05 ?>
        <div class="sm-w">
		<h2>Ricerca Professionista</h2>
        <?php if(function_exists('wp_custom_fields_search')) 
		 wp_custom_fields_search(); ?>
	</div>
        
	</div>
    <div class="footer"></div>
</div>-->
<div id="row-1">
<div class="leftcolumn">
<div id="ricerca_home" class="cat-widget">
	<h3>
		<a title="Ricerca Professionale" href="#ricerca">Ricerca Professionista</a>
		<a class="minimize" href="#minimize"/>
		<a class="close" href="#close"/>
	</h3>
        <div class="container">
         <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(4) ): endif; ?>
		</div>
	        
	    <div class="footer"></div>
	</div>
</div>


<div class="rightcolumn">

    <div id="premium" class="cat-widget">
    	<h3>
		<a title="In evidenza" href="#ricerca">In evidenza</a>
		<a class="minimize" href="#minimize"/>
		<a class="close" href="#close"/>
		</h3>
    
    <div class="container">
    
   <?php $getposts = new WP_query(); $getposts->query('category_name=professionisti&meta_key=premium&showposts=4'); ?>
		<?php global $wp_query; $wp_query->in_the_loop = true; ?>
		<?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
    		
		 <h2><a href="#"><?php the_title(); ?></a></h2>
		<?php endwhile; ?>  
    </div>
 	    <div class="footer"></div>
   </div>
</div>
</div>

<?php 
	/**
	* inserimento banner pubblicitario come da richiesta
	* Agata 06.06.2009
	*/
?>
<!--	<a id="banner-home" href="#" title="pubblicit� Avvocato.it"><img src="<?php bloginfo('template_url'); ?>/styles/default/img/banner_top_home.gif" alt="banner home" /></a>
-->



<div class="featured">
<div class="content">
   
	<div class="sm-w">
	<h1><?php print FEATURED_STORIES; ?></h1>
	
	<?php $features = new WP_query(); $features->query('showposts='.$options['featured_n'].'&cat='.$options['featured']); ?>
	<?php global $wp_query; $wp_query->in_the_loop = true; ?>

	<ul id="featuredposts" class="featuredposts">
	<?php while ($features->have_posts()) : $features->the_post(); ?>
	<li><a href="#" rel="post-<?php the_ID(); ?>" class="selected"></a></li>
	<?php endwhile; ?>
	</ul><div class="clear"></div>
	</div>

	<?php while ($features->have_posts()) : $features->the_post(); ?>
	<div id="post-<?php the_ID(); ?>" class="featuredposts_content">
	<div class="thumb"><?php show_thumb($options['FTwidth'],$options['FTheight'],$options['crop'],$options['quality']); ?></div>
	<div class="fpost">
	
		<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
		<p><?php print do_excerpt(get_the_excerpt(), 40); ?></p>
		<span class="read"><a href="<?php the_permalink(); ?>"><strong><?php print CONTINUE_READING_FULL_STORY; ?></strong></a> (<?php print READ; ?> <?php if(function_exists('the_views')) { the_views(); } ?> <?php print TIMES; ?>)</span>
		<span class="docomment"><a href="<?php the_permalink(); ?>#respond"><strong><?php print ADD_COMMENT; ?></strong></a> - <a href="<?php the_permalink(); ?>#comments"><strong><?php comments_number('0','1','%'); ?> <?php print USERS; ?></strong></a> <?php print COMMENTED_ON_POST; ?></span>
	
	</div>
	</div>
	<?php endwhile; ?>

	<script type="text/javascript">
	var featuredposts=new ddtabcontent("featuredposts")
	featuredposts.setpersist(false)
	featuredposts.setselectedClassTarget("link")
	featuredposts.init(7500)
	</script>

</div>
<div class="footer"></div>
</div>

<?php
$leftcategories = ARRAY(); // initiate
$rightcategories = ARRAY(); // initiate
for ($i = 1; $i <= $options['leftcatsN']; $i++ ) array_push($leftcategories, $options['leftcats'.$i]);
for ($i = 1; $i <= $options['rightcatsN']; $i++ ) array_push($rightcategories, $options['rightcats'.$i]);
?>

<div id="leftcolumn">

<?php foreach($leftcategories as $section) : ?>
<div class="cat-widget" id="<?php print str_replace(' ', '', get_cat_name($section)); ?>">

	<h3><a href="<?php print get_category_link($section); ?>" title="<?php print get_cat_name($section); ?>"><?php print get_cat_name($section); ?></a><a href="#minimize" class="minimize"></a><?php if ($options['closewidget'] == 1) : ?><a href="#close" class="close"></a><?php endif; ?></h3>
	<div class="container">
	
		<?php $getposts = new WP_query(); $getposts->query('showposts='.$options['leftpostnum'].'&cat='.$section); ?>
		<?php global $wp_query; $wp_query->in_the_loop = true; ?>
		<?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
		<div class="cpost">
		<div class="thumb"><?php show_thumb($options['MTwidth'],$options['MTheight'],$options['crop'],$options['quality']); ?></div>
		<div class="info">

		<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="dark_perm"><?php the_title(); ?></a>
		<p><?php print do_excerpt(get_the_excerpt(), 15); ?></p>
		
		<span class="ex">
		<a href="<?php the_permalink(); ?>" class="cont"><?php print CONTINUE_TEXT; ?></a>
		<a href="<?php the_permalink(); ?>#comments" class="comm"><?php comments_number(NO_COMMENTS,ONE_COMMENT,MORE_COMMENTS); ?></a>
		</span><div class="clear"></div>
		
		</div><div class="clear"></div>
		</div>
		<?php endwhile; ?>

		<h4><?php print MORE_STORIES; ?><a href="#more" class="plus"></a><a href="#less" class="minus"></a></h4>

		<ul class="more_stories">
		<?php $getposts = new WP_query(); $getposts->query('showposts=10&offset=1&cat='.$section); ?>
		<?php global $wp_query; $wp_query->in_the_loop = true; ?>
		<?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
		<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
		<?php endwhile; ?>
		</ul>

	</div>
	<div class="footer"></div>

</div>
<?php endforeach; ?>

</div>

<div id="rightcolumn">

<?php foreach($rightcategories as $section) : ?>
<div class="cat-widget" id="<?php print str_replace(' ', '', get_cat_name($section)); ?>">

	<h3><a href="<?php print get_category_link($section); ?>" title="<?php print get_cat_name($section); ?>"><?php print get_cat_name($section); ?></a><a href="#minimize" class="minimize"></a><?php if ($options['closewidget'] == 1) : ?><a href="#close" class="close"></a><?php endif; ?></h3>
	<div class="container">
	
		<?php $getposts = new WP_query(); $getposts->query('showposts='.$options['rightpostnum'].'&cat='.$section); ?>
		<?php global $wp_query; $wp_query->in_the_loop = true; ?>
		<?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
		<div class="cpost">
		<div class="thumb"><?php show_thumb($options['MTwidth'],$options['MTheight'],$options['crop'],$options['quality']); ?></div>
		<div class="info">

		<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="dark_perm"><?php the_title(); ?></a>
		<p><?php print do_excerpt(get_the_excerpt(), 15); ?></p>
		
		<span class="ex">
		<a href="<?php the_permalink(); ?>" class="cont"><?php print CONTINUE_TEXT; ?></a>
		<a href="<?php the_permalink(); ?>#comments" class="comm"><?php comments_number(NO_COMMENTS,ONE_COMMENT,MORE_COMMENTS); ?></a>
		</span><div class="clear"></div>
		
		</div><div class="clear"></div>
		</div>
		<?php endwhile; ?>

		<h4><?php print MORE_STORIES; ?><a href="#more" class="plus"></a><a href="#less" class="minus"></a></h4>

		<ul class="more_stories">
		<?php $getposts = new WP_query(); $getposts->query('showposts=10&offset=1&cat='.$section); ?>
		<?php global $wp_query; $wp_query->in_the_loop = true; ?>
		<?php while ($getposts->have_posts()) : $getposts->the_post(); ?>
		<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
		<?php endwhile; ?>
		</ul>

	</div>
	<div class="footer"></div>

</div>
<?php endforeach; ?>

</div>

<div class="clear"></div>
</div>
 
<?php get_sidebar(); ?>

<?php get_footer(); ?>